home *** CD-ROM | disk | FTP | other *** search
/ Merciful 2 / Merciful - Disc 2.iso / software / i / iconianv2.97reg.lha / Iconian / Macros / add.icrx next >
Text File  |  1995-10-01  |  2KB  |  73 lines

  1. /* An example REXX script for Iconian */
  2.  
  3. /* Pretty useless macro, really,
  4.    all it does is draw a 11x11 box around
  5.    the mouse cursor, adding 1 to the value
  6.    of each pixel.  Is smart enough to wrap
  7.    the last color of the scree to color 0.*/
  8.  
  9. /* PS: Expect this script to take LOTS and LOTS of time! */
  10.  
  11. /* As this is expected to be run as a MACRO, Iconian will supply it's OWN address name! */
  12. /* Otherwise, we'd need ADDRESS ICONIAN.1 */
  13.  
  14.  
  15. /* Signal we wish to obtain results. */
  16. options results
  17.  
  18. /* grab current mouse coords */
  19. 'getcoord x'
  20. mx=result
  21. 'getcoord y'
  22. my=result
  23.  
  24. /* Lock the GUI so the user can interfere! */
  25. /* The FASTDRAW switch disables visual feedback during the locked phase.*/
  26.  
  27. lockgui FASTDRAW
  28.  
  29. /* Ask for the screen depth */
  30. 'getscreendepth'
  31. depth=result
  32.  
  33. /* Now, convert that to the number of colors */
  34. /* (Is there an easier way? Can rexx do a SHL? */
  35. IF depth=1 THEN numofcolors=2
  36. IF depth=2 THEN numofcolors=4
  37. IF depth=3 THEN numofcolors=8
  38. IF depth=4 THEN numofcolors=16
  39. IF depth=5 THEN numofcolors=32
  40. IF depth=6 THEN numofcolors=64
  41. IF depth=7 THEN numofcolors=128
  42. IF depth=8 THEN numofcolors=256
  43.  
  44. numofcolors=numofcolors-1
  45.  
  46. /* do a loop, -5 to +5 and -5 to +5 */
  47.  
  48. /* note that we don't simply plot each pixel.. we "drag" the mouse around */
  49.  
  50. 'screentofront'
  51. 'plot'
  52.  
  53. Do t=my-5 to my+5
  54.   Do i=mx-5 to mx+5
  55.     getpixel i t
  56.     pen=result
  57.     pen=pen+1
  58.     If pen>=numofcolors Then pen=0
  59.     moveto i t
  60.     setfgcolor pen
  61.     IF mousedown=0 THEN
  62.       mousedown=1
  63.       leftmouse down
  64.     ENDIF
  65.     moveto i t
  66.   END
  67. END
  68.  
  69. leftmouse up
  70.  
  71. /* Let go of the GUI. */
  72. unlockgui
  73.